package com.supermap.imanager.notification.impl;

import java.io.File;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.supermap.utils.XMLManager;

public class Run_Imoc_API {
    public static void main(String[] args) {
//        // 要验证的字符串
//        String str = "service@xsoftlab.net";
//        // 邮箱验证规则
//        String regEx = "[a-zA-Z_]{1,}[0-9]{0,}@(([a-zA-z0-9]-*){1,}\\.){1,3}[a-zA-z\\-]{1,}";
//        // 编译正则表达式
//        Pattern pattern = Pattern.compile(regEx);
//        // 忽略大小写的写法
////         Pattern pat = Pattern.compile(regEx, Pattern.CASE_INSENSITIVE);
//        Matcher matcher = pattern.matcher(str);
//        // 字符串是否与正则表达式相匹配
//        boolean rs = matcher.matches();
//        System.out.println(rs);

//		ImocAlerm.getAlerm("abc", "supermap need restore ...", System.currentTimeMillis() + "", "2", true);
//		ImocAlerm.restoreAlerm("abc", "supermap need restore ...", System.currentTimeMillis() + "", "2");

//         判断是否存在xml文件
        String logPath = "C:\\Users\\zmgis\\Desktop\\data\\" + "Log.xml";
        File file = new File(logPath);
        if ( !file.exists() ) {
            XMLManager xmlManager = new XMLManager(logPath);
            try {
                xmlManager.write(logPath, "123456", "iserver", "iserver","http://localhost:8090/iserver", "iserver");
                xmlManager.write(logPath, "456789", "iserver", "iserver", "http://localhost:8090/iserver","iserver");
                xmlManager.write(logPath, "125678", "iserver", "iserver", "http://localhost:8090/iserver","iserver");
                xmlManager.write(logPath, "3456778", "iserver", "iserver", "http://localhost:8090/iserver", "iserver");
                xmlManager.write(logPath, "3456e778", "iserver", "iserver", "http://localhost:8090/iserver", "iserver");
                xmlManager.reader("123456", logPath);
            } catch (IOException e) {
                e.printStackTrace();
            }
            xmlManager.removeElement("123456", logPath);
        }

    }
}
